package com.smartcruise.util.image;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.smartcruise.R;

/**
 * Created by FengChaoQun
 * on 2016/7/14
 */
public class MyGlide {

    public static RequestOptions defaultOptions = new RequestOptions().placeholder(R.color.g0)
            .error(R.mipmap.nim_image_download_failed).fitCenter();


    public static void with(Activity activity, String url, ImageView view) {
        Glide.with(activity)
                .load(url)
                .apply(defaultOptions)
                .into(view);
    }

    public static void with(Fragment fragment, String url, ImageView view) {
        Glide.with(fragment)
                .load(url)
                .apply(defaultOptions)
                .into(view);
    }

    public static void with(Context context, String url, ImageView view) {
        Glide.with(context)
                .load(url)
                .apply(defaultOptions)
                .into(view);
    }

}
